home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb-4.5 / dist / gdb / gdb.info-5 < prev    next >
Encoding:
Text File  |  1992-04-11  |  48.0 KB  |  1,244 lines

  1. Info file ./gdb.info, produced by Makeinfo, -*- Text -*- from input
  2. file gdb-all.texi.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * Gdb: (gdb).                   The GNU debugger.
  6. END-INFO-DIR-ENTRY
  7.    This file documents the GNU debugger GDB.
  8.  
  9.    This is Edition 4.04, March 1992, of `Using GDB: A Guide to the GNU
  10. Source-Level Debugger' for GDB Version 4.5.
  11.  
  12.    Copyright (C) 1988, 1989, 1990, 1991, 1992 Free Software
  13. Foundation, Inc.
  14.  
  15.    Permission is granted to make and distribute verbatim copies of
  16. this manual provided the copyright notice and this permission notice
  17. are preserved on all copies.
  18.  
  19.    Permission is granted to copy and distribute modified versions of
  20. this manual under the conditions for verbatim copying, provided also
  21. that the section entitled "GNU General Public License" is included
  22. exactly as in the original, and provided that the entire resulting
  23. derived work is distributed under the terms of a permission notice
  24. identical to this one.
  25.  
  26.    Permission is granted to copy and distribute translations of this
  27. manual into another language, under the above conditions for modified
  28. versions, except that the section entitled "GNU General Public
  29. License" may be included in a translation approved by the Free
  30. Software Foundation instead of in the original English.
  31.  
  32. 
  33. File: gdb.info,  Node: Files,  Next: Symbol Errors,  Prev: GDB Files,  Up: GDB Files
  34.  
  35. Commands to Specify Files
  36. =========================
  37.  
  38.    The usual way to specify executable and core dump file names is with
  39. the command arguments given when you start GDB, (*note Getting In and
  40. Out of GDB: Invocation..
  41.  
  42.    Occasionally it is necessary to change to a different file during a
  43. GDB session.  Or you may run GDB and forget to specify the files you
  44. want to use.  In these situations the GDB commands to specify new files
  45. are useful.
  46.  
  47. `file FILENAME'
  48.      Use FILENAME as the program to be debugged.  It is read for its
  49.      symbols and for the contents of pure memory.  It is also the
  50.      program executed when you use the `run' command.  If you do not
  51.      specify a directory and the file is not found in GDB's working
  52.      directory, GDB uses the environment variable `PATH' as a list of
  53.      directories to search, just as the shell does when looking for a
  54.      program to run.  You can change the value of this variable, for
  55.      both GDB and your program, using the `path' command.
  56.  
  57.      On systems with memory-mapped files, an auxiliary symbol table
  58.      file `FILENAME.syms' may be available for FILENAME.  If it is,
  59.      GDB will map in the symbol table from `FILENAME.syms', starting
  60.      up more quickly.  See the descriptions of the options `-mapped'
  61.      and `-readnow' (available on the command line, and with the
  62.      commands `file', `symbol-file', or `add-symbol-file'), for more
  63.      information.
  64.  
  65. `file'
  66.      `file' with no argument makes GDB discard any information it has
  67.      on both executable file and the symbol table.
  68.  
  69. `exec-file [ FILENAME ]'
  70.      Specify that the program to be run (but not the symbol table) is
  71.      found in FILENAME.  GDB will search the environment variable
  72.      `PATH' if necessary to locate your program.  Omitting FILENAME
  73.      means to discard information on the executable file.
  74.  
  75. `symbol-file [ FILENAME ]'
  76.      Read symbol table information from file FILENAME.  `PATH' is
  77.      searched when necessary.  Use the `file' command to get both
  78.      symbol table and program to run from the same file.
  79.  
  80.      `symbol-file' with no argument clears out GDB's information on
  81.      your program's symbol table.
  82.  
  83.      The `symbol-file' command causes GDB to forget the contents of its
  84.      convenience variables, the value history, and all breakpoints and
  85.      auto-display expressions.  This is because they may contain
  86.      pointers to the internal data recording symbols and data types,
  87.      which are part of the old symbol table data being discarded
  88.      inside GDB.
  89.  
  90.      `symbol-file' will not repeat if you press RET again after
  91.      executing it once.
  92.  
  93.      When GDB is configured for a particular environment, it will
  94.      understand debugging information in whatever format is the
  95.      standard generated for that environment; you may use either a GNU
  96.      compiler, or other compilers that adhere to the local
  97.      conventions.  Best results are usually obtained from GNU
  98.      compilers; for example, using `gcc' you can generate debugging
  99.      information for optimized code.
  100.  
  101.      On some kinds of object files, the `symbol-file' command does not
  102.      normally read the symbol table in full right away.  Instead, it
  103.      scans the symbol table quickly to find which source files and
  104.      which symbols are present.  The details are read later, one
  105.      source file at a time, as they are needed.
  106.  
  107.      The purpose of this two-stage reading strategy is to make GDB
  108.      start up faster.  For the most part, it is invisible except for
  109.      occasional pauses while the symbol table details for a particular
  110.      source file are being read.  (The `set verbose' command can turn
  111.      these pauses into messages if desired. *Note Optional Warnings
  112.      and Messages: Messages/Warnings.)
  113.  
  114.      When the symbol table is stored in COFF format, `symbol-file' does
  115.      read the symbol table data in full right away.  We have not
  116.      implemented the two-stage strategy for COFF yet.
  117.  
  118. `symbol-file FILENAME [ -readnow ] [ -mapped ]'
  119. `file FILENAME [ -readnow ] [ -mapped ]'
  120.      You can override the GDB two-stage strategy for reading symbol
  121.      tables by using the `-readnow' option with any of the commands
  122.      that load symbol table information, if you want to be sure GDB
  123.      has the entire symbol table available.
  124.  
  125.      If memory-mapped files are available on your system through the
  126.      `mmap' system call, you can use another option, `-mapped', to
  127.      cause GDB to write the symbols for your program into a reusable
  128.      file.  Future GDB debugging sessions will map in symbol
  129.      information from this auxiliary symbol file (if the program
  130.      hasn't changed), rather than spending time reading the symbol
  131.      table from the executable program.  Using the `-mapped' option
  132.      has the same effect as starting GDB with the `-mapped'
  133.      command-line option.
  134.  
  135.      You can use both options together, to make sure the auxiliary
  136.      symbol file has all the symbol information for your program.
  137.  
  138.      The `.syms' file is specific to the host machine on which GDB is
  139.      run.  It holds an exact image of GDB's internal symbol table.  It
  140.      cannot be shared across multiple host platforms.
  141.  
  142.      The auxiliary symbol file for a program called MYPROG is called
  143.      `MYPROG.syms'.  Once this file exists (so long as it is newer
  144.      than the corresponding executable), GDB will always attempt to use
  145.      it when you debug MYPROG; no special options or commands are
  146.      needed.
  147.  
  148. `core-file [ FILENAME ]'
  149.      Specify the whereabouts of a core dump file to be used as the
  150.      "contents of memory".  Traditionally, core files contain only
  151.      some parts of the address space of the process that generated
  152.      them; GDB can access the executable file itself for other parts.
  153.  
  154.      `core-file' with no argument specifies that no core file is to be
  155.      used.
  156.  
  157.      Note that the core file is ignored when your program is actually
  158.      running under GDB.  So, if you have been running your program and
  159.      you wish to debug a core file instead, you must kill the
  160.      subprocess in which the program is running.  To do this, use the
  161.      `kill' command (*note Killing the Child Process: Kill Process.).
  162.  
  163. `load FILENAME'
  164.      Depending on what remote debugging facilities are configured into
  165.      GDB, the `load' command may be available.  Where it exists, it is
  166.      meant to make FILENAME (an executable) available for debugging on
  167.      the remote system--by downloading, or dynamic linking, for
  168.      example.  `load' also records FILENAME's symbol table in GDB, like
  169.      the `add-symbol-file' command.
  170.  
  171.      If `load' is not available on your GDB, attempting to execute it
  172.      gets the error message "`You can't do that when your target is
  173.      ...'"
  174.  
  175.      On VxWorks, `load' will dynamically link FILENAME on the current
  176.      target system as well as adding its symbols in GDB.
  177.  
  178.      With the Nindy interface to an Intel 960 board, `load' will
  179.      download FILENAME to the 960 as well as adding its symbols in GDB.
  180.  
  181.      `load' will not repeat if you press RET again after using it.
  182.  
  183. `add-symbol-file FILENAME ADDRESS'
  184. `add-symbol-file FILENAME ADDRESS [ -readnow ] [ -mapped ]'
  185.      The `add-symbol-file' command reads additional symbol table
  186.      information from the file FILENAME.  You would use this command
  187.      when FILENAME has been dynamically loaded (by some other means)
  188.      into the program that is running.  ADDRESS should be the memory
  189.      address at which the file has been loaded; GDB cannot figure this
  190.      out for itself.
  191.  
  192.      The symbol table of the file FILENAME is added to the symbol table
  193.      originally read with the `symbol-file' command.  You can use the
  194.      `add-symbol-file' command any number of times; the new symbol
  195.      data thus read keeps adding to the old.  To discard all old
  196.      symbol data instead, use the `symbol-file' command.
  197.  
  198.      `add-symbol-file' will not repeat if you press RET after using it.
  199.  
  200.      You can use the `-mapped' and `-readnow' options just as with the
  201.      `symbol-file' command, to change how GDB manages the symbol tabl
  202.      einformation for FILENAME.
  203.  
  204. `info files'
  205. `info target'
  206.      `info files' and `info target' are synonymous; both print the
  207.      current targets (*note Specifying a Debugging Target: Targets.),
  208.      including the names of the executable and core dump files
  209.      currently in use by GDB, and the files from which symbols were
  210.      loaded.  The command `help targets' lists all possible targets
  211.      rather than current ones.
  212.  
  213.    All file-specifying commands allow both absolute and relative file
  214. names as arguments.  GDB always converts the file name to an absolute
  215. path name and remembers it that way.
  216.  
  217.    GDB supports SunOS, SVR4, and IBM RS/6000 shared libraries.  GDB
  218. automatically loads symbol definitions from shared libraries when you
  219. use the `run' command, or when you examine a core file.  (Before you
  220. issue the `run' command, GDB will not understand references to a
  221. function in a shared library, however--unless you are debugging a core
  222. file).
  223.  
  224. `info share'
  225. `info sharedlibrary'
  226.      Print the names of the shared libraries which are currently
  227.      loaded.
  228.  
  229. `sharedlibrary REGEX'
  230. `share REGEX'
  231.      This is an obsolescent command; you can use it to explicitly load
  232.      shared object library symbols for files matching a UNIX regular
  233.      expression, but as with files loaded automatically, it will only
  234.      load shared libraries required by your program for a core file or
  235.      after typing `run'.  If REGEX is omitted all shared libraries
  236.      required by your program are loaded.
  237.  
  238. 
  239. File: gdb.info,  Node: Symbol Errors,  Prev: Files,  Up: GDB Files
  240.  
  241. Errors Reading Symbol Files
  242. ===========================
  243.  
  244.    While reading a symbol file, GDB will occasionally encounter
  245. problems, such as symbol types it does not recognize, or known bugs in
  246. compiler output.  By default, GDB does not notify you of such
  247. problems, since they are relatively common and primarily of interest
  248. to people debugging compilers.  If you are interested in seeing
  249. information about ill-constructed symbol tables, you can either ask
  250. GDB to print only one message about each such type of problem, no
  251. matter how many times the problem occurs; or you can ask GDB to print
  252. more messages, to see how many times the problems occur, with the `set
  253. complaints' command (*note Optional Warnings and Messages:
  254. Messages/Warnings.).
  255.  
  256.    The messages currently printed, and their meanings, are:
  257.  
  258. `inner block not inside outer block in SYMBOL'
  259.      The symbol information shows where symbol scopes begin and end
  260.      (such as at the start of a function or a block of statements). 
  261.      This error indicates that an inner scope block is not fully
  262.      contained in its outer scope blocks.
  263.  
  264.      GDB circumvents the problem by treating the inner block as if it
  265.      had the same scope as the outer block.  In the error message,
  266.      SYMBOL may be shown as "`(don't know)'" if the outer block is not
  267.      a function.
  268.  
  269. `block at ADDRESS out of order'
  270.      The symbol information for symbol scope blocks should occur in
  271.      order of increasing addresses.  This error indicates that it does
  272.      not do so.
  273.  
  274.      GDB does not circumvent this problem, and will have trouble
  275.      locating symbols in the source file whose symbols being read. 
  276.      (You can often determine what source file is affected by
  277.      specifying `set verbose on'.  *Note Optional Warnings and
  278.      Messages: Messages/Warnings.)
  279.  
  280. `bad block start address patched'
  281.      The symbol information for a symbol scope block has a start
  282.      address smaller than the address of the preceding source line. 
  283.      This is known to occur in the SunOS 4.1.1 (and earlier) C
  284.      compiler.
  285.  
  286.      GDB circumvents the problem by treating the symbol scope block as
  287.      starting on the previous source line.
  288.  
  289. `bad string table offset in symbol N'
  290.      Symbol number N contains a pointer into the string table which is
  291.      larger than the size of the string table.
  292.  
  293.      GDB circumvents the problem by considering the symbol to have the
  294.      name `foo', which may cause other problems if many symbols end up
  295.      with this name.
  296.  
  297. `unknown symbol type `0xNN''
  298.      The symbol information contains new data types that GDB does not
  299.      yet know how to read.  `0xNN' is the symbol type of the
  300.      misunderstood information, in hexadecimal.
  301.  
  302.      GDB circumvents the error by ignoring this symbol information. 
  303.      This will usually allow your program to be debugged, though
  304.      certain symbols will not be accessible.  If you encounter such a
  305.      problem and feel like debugging it, you can debug `gdb' with
  306.      itself, breakpoint on `complain', then go up to the function
  307.      `read_dbx_symtab' and examine `*bufp' to see the symbol.
  308.  
  309. `stub type has NULL name'
  310.      GDB could not find the full definition for a struct or class.
  311.  
  312. `const/volatile indicator missing (ok if using g++ v1.x), got...'
  313.      The symbol information for a C++ member function is missing some
  314.      information that recent versions of the compiler should have
  315.      output for it.
  316.  
  317. `info mismatch between compiler and debugger'
  318.      GDB could not parse a type specification output by the compiler.
  319.  
  320. 
  321. File: gdb.info,  Node: Targets,  Next: Controlling GDB,  Prev: GDB Files,  Up: Top
  322.  
  323. Specifying a Debugging Target
  324. *****************************
  325.  
  326.    A "target" is the execution environment occupied by your program. 
  327. Often, GDB runs in the same host environment as your program; in that
  328. case, the debugging target is specified as a side effect when you use
  329. the `file' or `core' commands.  When you need more flexibility--for
  330. example, running GDB on a physically separate host, or controlling a
  331. standalone system over a serial port or a realtime system over a
  332. TCP/IP connection--you can use the `target' command to specify one of
  333. the target types configured for GDB (*note Commands for Managing
  334. Targets: Target Commands.).
  335.  
  336. * Menu:
  337.  
  338. * Active Targets::              Active Targets
  339. * Target Commands::             Commands for Managing Targets
  340. * Remote::                      Remote Debugging
  341.  
  342. 
  343. File: gdb.info,  Node: Active Targets,  Next: Target Commands,  Prev: Targets,  Up: Targets
  344.  
  345. Active Targets
  346. ==============
  347.  
  348.    There are three classes of targets: processes, core files, and
  349. executable files.  GDB can work concurrently on up to three active
  350. targets, one in each class.  This allows you to (for example) start a
  351. process and inspect its activity without abandoning your work on a core
  352. file.
  353.  
  354.    If, for example, you execute `gdb a.out', then the executable file
  355. `a.out' is the only active target.  If you designate a core file as
  356. well--presumably from a prior run that crashed and coredumped--then
  357. GDB has two active targets and will use them in tandem, looking first
  358. in the corefile target, then in the executable file, to satisfy
  359. requests for memory addresses.  (Typically, these two classes of target
  360. are complementary, since core files contain only a program's
  361. read-write memory--variables and so on--plus machine status, while
  362. executable files contain only the program text and initialized data.)
  363.  
  364.    When you type `run', your executable file becomes an active process
  365. target as well.  When a process target is active, all GDB commands
  366. requesting memory addresses refer to that target; addresses in an
  367. active core file or executable file target are obscured while the
  368. process target is active.
  369.  
  370.    Use the `core-file' and `exec-file' commands to select a new core
  371. file or executable target (*note Commands to Specify Files: Files.). 
  372. To specify as a target a process that is already running, use the
  373. `attach' command (*note Debugging an Already-Running Process:
  374. Attach..).
  375.  
  376. 
  377. File: gdb.info,  Node: Target Commands,  Next: Remote,  Prev: Active Targets,  Up: Targets
  378.  
  379. Commands for Managing Targets
  380. =============================
  381.  
  382. `target TYPE PARAMETERS'
  383.      Connects the GDB host environment to a target machine or process.
  384.       A target is typically a protocol for talking to debugging
  385.      facilities.  You use the argument TYPE to specify the type or
  386.      protocol of the target machine.
  387.  
  388.      Further PARAMETERS are interpreted by the target protocol, but
  389.      typically include things like device names or host names to
  390.      connect with, process numbers, and baud rates.
  391.  
  392.      The `target' command will not repeat if you press RET again after
  393.      executing the command.
  394.  
  395. `help target'
  396.      Displays the names of all targets available.  To display targets
  397.      currently selected, use either `info target' or `info files'
  398.      (*note Commands to Specify Files: Files.).
  399.  
  400. `help target NAME'
  401.      Describe a particular target, including any parameters necessary
  402.      to select it.
  403.  
  404.    Here are some common targets (available, or not, depending on the
  405. GDB configuration):
  406.  
  407. `target exec PROG'
  408.      An executable file.  `target exec PROG' is the same as `exec-file
  409.      PROG'.
  410.  
  411. `target core FILENAME'
  412.      A core dump file.  `target core FILENAME' is the same as
  413.      `core-file FILENAME'.
  414.  
  415. `target remote DEV'
  416.      Remote serial target in GDB-specific protocol.  The argument DEV
  417.      specifies what serial device to use for the connection (e.g. 
  418.      `/dev/ttya'). *Note Remote Debugging: Remote.
  419.  
  420. `target amd-eb DEV SPEED PROG'
  421.      Remote PC-resident AMD EB29K board, attached over serial lines. 
  422.      DEV is the serial device, as for `target remote'; SPEED allows
  423.      you to specify the linespeed; and PROG is the name of the program
  424.      to be debugged, as it appears to DOS on the PC.  *Note GDB with a
  425.      Remote EB29K: EB29K Remote.
  426.  
  427. `target nindy DEVICENAME'
  428.      An Intel 960 board controlled by a Nindy Monitor.  DEVICENAME is
  429.      the name of the serial device to use for the connection, e.g. 
  430.      `/dev/ttya'.  *Note GDB with a Remote i960 (Nindy): i960-Nindy
  431.      Remote.
  432.  
  433. `target vxworks MACHINENAME'
  434.      A VxWorks system, attached via TCP/IP.  The argument MACHINENAME
  435.      is the target system's machine name or IP address.  *Note GDB and
  436.      VxWorks: VxWorks Remote.
  437.  
  438.    Different targets are available on different configurations of GDB;
  439. your configuration may have more or fewer targets.
  440.  
  441. 
  442. File: gdb.info,  Node: Remote,  Prev: Target Commands,  Up: Targets
  443.  
  444. Remote Debugging
  445. ================
  446.  
  447.    If you are trying to debug a program running on a machine that
  448. cannot run GDB in the usual way, it is often useful to use remote
  449. debugging.  For example, you might use remote debugging on an
  450. operating system kernel, or on a small system which does not have a
  451. general purpose operating system powerful enough to run a
  452. full-featured debugger.
  453.  
  454.    Some configurations of GDB have special serial or TCP/IP interfaces
  455. to make this work with particular debugging targets.  In addition, GDB
  456. comes with a generic serial protocol (specific to GDB, but not
  457. specific to any particular target system) which you can use if you
  458. write the remote stubs--the code that will run on the remote system to
  459. communicate with GDB.
  460.  
  461.    To use the GDB remote serial protocol, the program to be debugged on
  462. the remote machine needs to contain a debugging stub which talks to
  463. GDB over the serial line.  Several working remote stubs are
  464. distributed with GDB; see the `README' file in the GDB distribution
  465. for more information.
  466.  
  467.    For details of this communication protocol, see the comments in the
  468. GDB source file `remote.c'.
  469.  
  470.    To start remote debugging, first run GDB and specify as an
  471. executable file the program that is running in the remote machine. 
  472. This tells GDB how to find your program's symbols and the contents of
  473. its pure text.  Then establish communication using the `target remote'
  474. command with a device name as an argument.  For example:
  475.  
  476.      target remote /dev/ttyb
  477.  
  478. if the serial line is connected to the device named `/dev/ttyb'.  This
  479. will stop the remote machine if it is not already stopped.
  480.  
  481.    Now you can use all the usual commands to examine and change data
  482. and to step and continue the remote program.
  483.  
  484.    To resume the remote program and stop debugging it, use the `detach'
  485. command.
  486.  
  487.    Other remote targets may be available in your configuration of GDB;
  488. use `help targets' to list them.
  489.  
  490. * Menu:
  491.  
  492. * i960-Nindy Remote::        GDB with a Remote i960 (Nindy)
  493. * EB29K Remote::        GDB with a Remote EB29K
  494. * VxWorks Remote::        GDB and VxWorks
  495.  
  496. 
  497. File: gdb.info,  Node: i960-Nindy Remote,  Next: EB29K Remote,  Prev: Remote,  Up: Remote
  498.  
  499. GDB with a Remote i960 (Nindy)
  500. ------------------------------
  501.  
  502.    "Nindy" is a ROM Monitor program for Intel 960 target systems.  When
  503. GDB is configured to control a remote Intel 960 using Nindy, you can
  504. tell GDB how to connect to the 960 in several ways:
  505.  
  506.    * Through command line options specifying serial port, version of
  507.      the Nindy protocol, and communications speed;
  508.  
  509.    * By responding to a prompt on startup;
  510.  
  511.    * By using the `target' command at any point during your GDB
  512.      session.  *Note Commands for Managing Targets: Target Commands.
  513.  
  514. * Menu:
  515.  
  516. * Nindy Startup::               Startup with Nindy
  517. * Nindy Options::               Options for Nindy
  518. * Nindy reset::                 Nindy Reset Command
  519.  
  520. 
  521. File: gdb.info,  Node: Nindy Startup,  Next: Nindy Options,  Prev: i960-Nindy Remote,  Up: i960-Nindy Remote
  522.  
  523. Startup with Nindy
  524. ..................
  525.  
  526.    If you simply start `gdb' without using any command-line options,
  527. you are prompted for what serial port to use, *before* you reach the
  528. ordinary GDB prompt:
  529.  
  530.      Attach /dev/ttyNN -- specify NN, or "quit" to quit:
  531.  
  532. Respond to the prompt with whatever suffix (after `/dev/tty')
  533. identifies the serial port you want to use.  You can, if you choose,
  534. simply start up with no Nindy connection by responding to the prompt
  535. with an empty line.  If you do this, and later wish to attach to Nindy,
  536. use `target' (*note Commands for Managing Targets: Target Commands.).
  537.  
  538. 
  539. File: gdb.info,  Node: Nindy Options,  Next: Nindy reset,  Prev: Nindy Startup,  Up: i960-Nindy Remote
  540.  
  541. Options for Nindy
  542. .................
  543.  
  544.    These are the startup options for beginning your GDB session with a
  545. Nindy-960 board attached:
  546.  
  547. `-r PORT'
  548.      Specify the serial port name of a serial interface to be used to
  549.      connect to the target system.  This option is only available when
  550.      GDB is configured for the Intel 960 target architecture.  You may
  551.      specify PORT as any of: a full pathname (e.g. `-r /dev/ttya'), a
  552.      device name in `/dev' (e.g. `-r ttya'), or simply the unique
  553.      suffix for a specific `tty' (e.g. `-r a').
  554.  
  555. `-O'
  556.      (An uppercase letter "O", not a zero.)  Specify that GDB should
  557.      use the "old" Nindy monitor protocol to connect to the target
  558.      system.  This option is only available when GDB is configured for
  559.      the Intel 960 target architecture.
  560.  
  561.           *Warning:* if you specify `-O', but are actually trying to
  562.           connect to a target system that expects the newer protocol,
  563.           the connection will fail, appearing to be a speed mismatch. 
  564.           GDB will repeatedly attempt to reconnect at several
  565.           different line speeds.  You can abort this process with an
  566.           interrupt.
  567.  
  568. `-brk'
  569.      Specify that GDB should first send a `BREAK' signal to the target
  570.      system, in an attempt to reset it, before connecting to a Nindy
  571.      target.
  572.  
  573.           *Warning:* Many target systems do not have the hardware that
  574.           this requires; it only works with a few boards.
  575.  
  576.    The standard `-b' option controls the line speed used on the serial
  577. port.
  578.  
  579. 
  580. File: gdb.info,  Node: Nindy reset,  Prev: Nindy Options,  Up: i960-Nindy Remote
  581.  
  582. Nindy Reset Command
  583. ...................
  584.  
  585. `reset'
  586.      For a Nindy target, this command sends a "break" to the remote
  587.      target system; this is only useful if the target has been
  588.      equipped with a circuit to perform a hard reset (or some other
  589.      interesting action) when a break is detected.
  590.  
  591. 
  592. File: gdb.info,  Node: EB29K Remote,  Next: VxWorks Remote,  Prev: i960-Nindy Remote,  Up: Remote
  593.  
  594. GDB with a Remote EB29K
  595. -----------------------
  596.  
  597.    To use GDB from a Unix system to run programs on AMD's EB29K board
  598. in a PC, you must first connect a serial cable between the PC and a
  599. serial port on the Unix system.  In the following, we assume you've
  600. hooked the cable between the PC's `COM1' port and `/dev/ttya' on the
  601. Unix system.
  602.  
  603. * Menu:
  604.  
  605. * Comms (EB29K)::               Communications Setup
  606. * gdb-EB29K::                   EB29K cross-debugging
  607. * Remote Log::                  Remote Log
  608.  
  609. 
  610. File: gdb.info,  Node: Comms (EB29K),  Next: gdb-EB29K,  Prev: EB29K Remote,  Up: EB29K Remote
  611.  
  612. Communications Setup
  613. ....................
  614.  
  615.    The next step is to set up the PC's port, by doing something like
  616. the following in DOS on the PC:
  617.  
  618.      C:\> MODE com1:9600,n,8,1,none
  619.  
  620. This example--run on an MS DOS 4.0 system--sets the PC port to 9600
  621. bps, no parity, eight data bits, one stop bit, and no "retry" action;
  622. you must match the communications parameters when establishing the Unix
  623. end of the connection as well.
  624.  
  625.    To give control of the PC to the Unix side of the serial line, type
  626. the following at the DOS console:
  627.  
  628.      C:\> CTTY com1
  629.  
  630. (Later, if you wish to return control to the DOS console, you can use
  631. the command `CTTY con'--but you must send it over the device that had
  632. control, in our example over the `COM1' serial line).
  633.  
  634.    From the Unix host, use a communications program such as `tip' or
  635. `cu' to communicate with the PC; for example,
  636.  
  637.      cu -s 9600 -l /dev/ttya
  638.  
  639. The `cu' options shown specify, respectively, the linespeed and the
  640. serial port to use.  If you use `tip' instead, your command line may
  641. look something like the following:
  642.  
  643.      tip -9600 /dev/ttya
  644.  
  645. Your system may define a different name where our example uses
  646. `/dev/ttya' as the argument to `tip'.  The communications parameters,
  647. including which port to use, are associated with the `tip' argument in
  648. the "remote" descriptions file--normally the system table
  649. `/etc/remote'.
  650.  
  651.    Using the `tip' or `cu' connection, change the DOS working
  652. directory to the directory containing a copy of your 29K program, then
  653. start the PC program `EBMON' (an EB29K control program supplied with
  654. your board by AMD).  You should see an initial display from `EBMON'
  655. similar to the one that follows, ending with the `EBMON' prompt `#'--
  656.  
  657.      C:\> G:
  658.      
  659.      G:\> CD \usr\joe\work29k
  660.      
  661.      G:\USR\JOE\WORK29K> EBMON
  662.      Am29000 PC Coprocessor Board Monitor, version 3.0-18
  663.      Copyright 1990 Advanced Micro Devices, Inc.
  664.      Written by Gibbons and Associates, Inc.
  665.      
  666.      Enter '?' or 'H' for help
  667.      
  668.      PC Coprocessor Type   = EB29K
  669.      I/O Base              = 0x208
  670.      Memory Base           = 0xd0000
  671.      
  672.      Data Memory Size      = 2048KB
  673.      Available I-RAM Range = 0x8000 to 0x1fffff
  674.      Available D-RAM Range = 0x80002000 to 0x801fffff
  675.      
  676.      PageSize              = 0x400
  677.      Register Stack Size   = 0x800
  678.      Memory Stack Size     = 0x1800
  679.      
  680.      CPU PRL               = 0x3
  681.      Am29027 Available     = No
  682.      Byte Write Available  = Yes
  683.      
  684.      # ~.
  685.  
  686.    Then exit the `cu' or `tip' program (done in the example by typing
  687. `~.' at the `EBMON' prompt).  `EBMON' will keep running, ready for GDB
  688. to take over.
  689.  
  690.    For this example, we've assumed what is probably the most convenient
  691. way to make sure the same 29K program is on both the PC and the Unix
  692. system: a PC/NFS connection that establishes "drive `G:'" on the PC as
  693. a file system on the Unix host.  If you do not have PC/NFS or
  694. something similar connecting the two systems, you must arrange some
  695. other way--perhaps floppy-disk transfer--of getting the 29K program
  696. from the Unix system to the PC; GDB will *not* download it over the
  697. serial line.
  698.  
  699. 
  700. File: gdb.info,  Node: gdb-EB29K,  Next: Remote Log,  Prev: Comms (EB29K),  Up: EB29K Remote
  701.  
  702. EB29K cross-debugging
  703. .....................
  704.  
  705.    Finally, `cd' to the directory containing an image of your 29K
  706. program on the Unix system, and start GDB--specifying as argument the
  707. name of your 29K program:
  708.  
  709.      cd /usr/joe/work29k
  710.      gdb myfoo
  711.  
  712.    Now you can use the `target' command:
  713.  
  714.      target amd-eb /dev/ttya 9600 MYFOO
  715.  
  716. In this example, we've assumed your program is in a file called
  717. `myfoo'.  Note that the filename given as the last argument to `target
  718. amd-eb' should be the name of the program as it appears to DOS.  In
  719. our example this is simply `MYFOO', but in general it can include a
  720. DOS path, and depending on your transfer mechanism may not resemble
  721. the name on the Unix side.
  722.  
  723.    At this point, you can set any breakpoints you wish; when you are
  724. ready to see your program run on the 29K board, use the GDB command
  725. `run'.
  726.  
  727.    To stop debugging the remote program, use the GDB `detach' command.
  728.  
  729.    To return control of the PC to its console, use `tip' or `cu' once
  730. again, after your GDB session has concluded, to attach to `EBMON'. 
  731. You can then type the command `q' to shut down `EBMON', returning
  732. control to the DOS command-line interpreter.  Type `CTTY con' to
  733. return command input to the main DOS console, and type `~.' to leave
  734. `tip' or `cu'.
  735.  
  736. 
  737. File: gdb.info,  Node: Remote Log,  Prev: gdb-EB29K,  Up: EB29K Remote
  738.  
  739. Remote Log
  740. ..........
  741.  
  742.    The `target amd-eb' command creates a file `eb.log' in the current
  743. working directory, to help debug problems with the connection. 
  744. `eb.log' records all the output from `EBMON', including echoes of the
  745. commands sent to it.  Running `tail -f' on this file in another window
  746. often helps to understand trouble with `EBMON', or unexpected events
  747. on the PC side of the connection.
  748.  
  749. 
  750. File: gdb.info,  Node: VxWorks Remote,  Prev: EB29K Remote,  Up: Remote
  751.  
  752. GDB and VxWorks
  753. ---------------
  754.  
  755.    GDB enables developers to spawn and debug tasks running on networked
  756. VxWorks targets from a Unix host.  Already-running tasks spawned from
  757. the VxWorks shell can also be debugged.  GDB uses code that runs on
  758. both the UNIX host and on the VxWorks target.  The program `gdb' is
  759. installed and executed on the UNIX host.
  760.  
  761.    The following information on connecting to VxWorks was current when
  762. this manual was produced; newer releases of VxWorks may use revised
  763. procedures.
  764.  
  765.    The remote debugging interface (RDB) routines are installed and
  766. executed on the VxWorks target.  These routines are included in the
  767. VxWorks library `rdb.a' and are incorporated into the system image
  768. when source-level debugging is enabled in the VxWorks configuration.
  769.  
  770.    If you wish, you can define `INCLUDE_RDB' in the VxWorks
  771. configuration file `configAll.h' to include the RDB interface routines
  772. and spawn the source debugging task `tRdbTask' when VxWorks is booted.
  773.  For more information on configuring and remaking VxWorks, see the
  774. manufacturer's manual.
  775.  
  776.    Once you have included the RDB interface in your VxWorks system
  777. image and set your Unix execution search path to find GDB, you are
  778. ready to run GDB.  From your UNIX host, type:
  779.  
  780.      % gdb
  781.  
  782.    GDB will come up showing the prompt:
  783.  
  784.      (gdb)
  785.  
  786. * Menu:
  787.  
  788. * VxWorks connection::          Connecting to VxWorks
  789. * VxWorks download::            VxWorks Download
  790. * VxWorks attach::              Running Tasks
  791.  
  792. 
  793. File: gdb.info,  Node: VxWorks connection,  Next: VxWorks download,  Prev: VxWorks Remote,  Up: VxWorks Remote
  794.  
  795. Connecting to VxWorks
  796. .....................
  797.  
  798.    The GDB command `target' lets you connect to a VxWorks target on the
  799. network.  To connect to a target whose host name is "`tt'", type:
  800.  
  801.      (gdb) target vxworks tt
  802.  
  803.    GDB will display a message similar to the following:
  804.  
  805.      Attaching remote machine across net... Success!
  806.  
  807.    GDB will then attempt to read the symbol tables of any object
  808. modules loaded into the VxWorks target since it was last booted.  GDB
  809. locates these files by searching the directories listed in the command
  810. search path (*note Your Program's Environment: Environment.); if it
  811. fails to find an object file, it will display a message such as:
  812.  
  813.      prog.o: No such file or directory.
  814.  
  815.    This will cause the `target' command to abort.  When this happens,
  816. you should add the appropriate directory to the search path, with the
  817. GDB command `path', and execute the `target' command again.
  818.  
  819. 
  820. File: gdb.info,  Node: VxWorks download,  Next: VxWorks attach,  Prev: VxWorks connection,  Up: VxWorks Remote
  821.  
  822. VxWorks Download
  823. ................
  824.  
  825.    If you have connected to the VxWorks target and you want to debug an
  826. object that has not yet been loaded, you can use the GDB `load'
  827. command to download a file from UNIX to VxWorks incrementally.  The
  828. object file given as an argument to the `load' command is actually
  829. opened twice: first by the VxWorks target in order to download the
  830. code, then by GDB in order to read the symbol table.  This can lead to
  831. problems if the current working directories on the two systems differ. 
  832. It is simplest to set the working directory on both systems to the
  833. directory in which the object file resides, and then to reference the
  834. file by its name, without any path.  Thus, to load a program `prog.o',
  835. residing in `wherever/vw/demo/rdb', on VxWorks type:
  836.  
  837.      -> cd "wherever/vw/demo/rdb"
  838.  
  839.    On GDB type:
  840.  
  841.      (gdb) cd wherever/vw/demo/rdb
  842.      (gdb) load prog.o
  843.  
  844.    GDB will display a response similar to the following:
  845.  
  846.      Reading symbol data from wherever/vw/demo/rdb/prog.o... done.
  847.  
  848.    You can also use the `load' command to reload an object module
  849. after editing and recompiling the corresponding source file.  Note that
  850. this will cause GDB to delete all currently-defined breakpoints,
  851. auto-displays, and convenience variables, and to clear the value
  852. history.  (This is necessary in order to preserve the integrity of
  853. debugger data structures that reference the target system's symbol
  854. table.)
  855.  
  856. 
  857. File: gdb.info,  Node: VxWorks attach,  Prev: VxWorks download,  Up: VxWorks Remote
  858.  
  859. Running Tasks
  860. .............
  861.  
  862.    You can also attach to an existing task using the `attach' command
  863. as follows:
  864.  
  865.      (gdb) attach TASK
  866.  
  867. where TASK is the VxWorks hexadecimal task ID.  The task can be running
  868. or suspended when you attach to it.  If running, it will be suspended
  869. at the time of attachment.
  870.  
  871. 
  872. File: gdb.info,  Node: Controlling GDB,  Next: Sequences,  Prev: Targets,  Up: Top
  873.  
  874. Controlling GDB
  875. ***************
  876.  
  877.    You can alter many aspects of GDB's interaction with you by using
  878. the `set' command.  For commands controlling how GDB displays data,
  879. *note Print Settings: Print Settings.; other settings are described
  880. here.
  881.  
  882. * Menu:
  883.  
  884. * Prompt::                      Prompt
  885. * Editing::                     Command Editing
  886. * History::                     Command History
  887. * Screen Size::                 Screen Size
  888. * Numbers::                     Numbers
  889. * Messages/Warnings::           Optional Warnings and Messages
  890.  
  891. 
  892. File: gdb.info,  Node: Prompt,  Next: Editing,  Prev: Controlling GDB,  Up: Controlling GDB
  893.  
  894. Prompt
  895. ======
  896.  
  897.    GDB indicates its readiness to read a command by printing a string
  898. called the "prompt".  This string is normally `(gdb)'.  You can change
  899. the prompt string with the `set prompt' command.  For instance, when
  900. debugging GDB with GDB, it is useful to change the prompt in one of
  901. the GDBs so that you can always tell which one you are talking to.
  902.  
  903. `set prompt NEWPROMPT'
  904.      Directs GDB to use NEWPROMPT as its prompt string henceforth.
  905.  
  906. `show prompt'
  907.      Prints a line of the form: `Gdb's prompt is: YOUR-PROMPT'
  908.  
  909. 
  910. File: gdb.info,  Node: Editing,  Next: History,  Prev: Prompt,  Up: Controlling GDB
  911.  
  912. Command Editing
  913. ===============
  914.  
  915.    GDB reads its input commands via the "readline" interface.  This
  916. GNU library provides consistent behavior for programs which provide a
  917. command line interface to the user.  Advantages are `emacs'-style or
  918. `vi'-style inline editing of commands, `csh'-like history
  919. substitution, and a storage and recall of command history across
  920. debugging sessions.
  921.  
  922.    You may control the behavior of command line editing in GDB with the
  923. command `set'.
  924.  
  925. `set editing'
  926. `set editing on'
  927.      Enable command line editing (enabled by default).
  928.  
  929. `set editing off'
  930.      Disable command line editing.
  931.  
  932. `show editing'
  933.      Show whether command line editing is enabled.
  934.  
  935. 
  936. File: gdb.info,  Node: History,  Next: Screen Size,  Prev: Editing,  Up: Controlling GDB
  937.  
  938. Command History
  939. ===============
  940.  
  941. `set history filename FNAME'
  942.      Set the name of the GDB command history file to FNAME.  This is
  943.      the file from which GDB will read an initial command history list
  944.      or to which it will write this list when it exits.  This list is
  945.      accessed through history expansion or through the history command
  946.      editing characters listed below.  This file defaults to the value
  947.      of the environment variable `GDBHISTFILE', or to `./.gdb_history'
  948.      if this variable is not set.
  949.  
  950. `set history save'
  951. `set history save on'
  952.      Record command history in a file, whose name may be specified
  953.      with the `set history filename' command.  By default, this option
  954.      is disabled.
  955.  
  956. `set history save off'
  957.      Stop recording command history in a file.
  958.  
  959. `set history size SIZE'
  960.      Set the number of commands which GDB will keep in its history
  961.      list.  This defaults to the value of the environment variable
  962.      `HISTSIZE', or to 256 if this variable is not set.
  963.  
  964.    History expansion assigns special meaning to the character `!'. 
  965. Since `!' is also the logical not operator in C, history expansion is
  966. off by default. If you decide to enable history expansion with the
  967. `set history expansion on' command, you may sometimes need to follow
  968. `!' (when it is used as logical not, in an expression) with a space or
  969. a tab to prevent it from being expanded.  The readline history
  970. facilities will not attempt substitution on the strings `!=' and `!(',
  971. even when history expansion is enabled.
  972.  
  973.    The commands to control history expansion are:
  974.  
  975. `set history expansion on'
  976. `set history expansion'
  977.      Enable history expansion.  History expansion is off by default.
  978.  
  979. `set history expansion off'
  980.      Disable history expansion.
  981.  
  982.      The readline code comes with more complete documentation of
  983.      editing and history expansion features.  Users unfamiliar with
  984.      `emacs' or `vi' may wish to read it.
  985.  
  986. `show history'
  987. `show history filename'
  988. `show history save'
  989. `show history size'
  990. `show history expansion'
  991.      These commands display the state of the GDB history parameters. 
  992.      `show history' by itself displays all four states.
  993.  
  994. `show commands'
  995.      Display the last ten commands in the command history.
  996.  
  997. `show commands N'
  998.      Print ten commands centered on command number N.
  999.  
  1000. `show commands +'
  1001.      Print ten commands just after the commands last printed.
  1002.  
  1003. 
  1004. File: gdb.info,  Node: Screen Size,  Next: Numbers,  Prev: History,  Up: Controlling GDB
  1005.  
  1006. Screen Size
  1007. ===========
  1008.  
  1009.    Certain commands to GDB may produce large amounts of information
  1010. output to the screen.  To help you read all of it, GDB pauses and asks
  1011. you for input at the end of each page of output.  Type RET when you
  1012. want to continue the output.  GDB also uses the screen width setting
  1013. to determine when to wrap lines of output.  Depending on what is being
  1014. printed, it tries to break the line at a readable place, rather than
  1015. simply letting it overflow onto the following line.
  1016.  
  1017.    Normally GDB knows the size of the screen from the termcap data base
  1018. together with the value of the `TERM' environment variable and the
  1019. `stty rows' and `stty cols' settings. If this is not correct, you can
  1020. override it with the `set height' and `set width' commands:
  1021.  
  1022. `set height LPP'
  1023. `show height'
  1024. `set width CPL'
  1025. `show width'
  1026.      These `set' commands specify a screen height of LPP lines and a
  1027.      screen width of CPL characters.  The associated `show' commands
  1028.      display the current settings.
  1029.  
  1030.      If you specify a height of zero lines, GDB will not pause during
  1031.      output no matter how long the output is.  This is useful if
  1032.      output is to a file or to an editor buffer.
  1033.  
  1034. 
  1035. File: gdb.info,  Node: Numbers,  Next: Messages/Warnings,  Prev: Screen Size,  Up: Controlling GDB
  1036.  
  1037. Numbers
  1038. =======
  1039.  
  1040.    You can always enter numbers in octal, decimal, or hexadecimal in
  1041. GDB by the usual conventions: octal numbers begin with `0', decimal
  1042. numbers end with `.', and hexadecimal numbers begin with `0x'. 
  1043. Numbers that begin with none of these are, by default, entered in base
  1044. 10; likewise, the default display for numbers--when no particular
  1045. format is specified--is base 10.  You can change the default base for
  1046. both input and output with the `set radix' command.
  1047.  
  1048. `set radix BASE'
  1049.      Set the default base for numeric input and display.  Supported
  1050.      choices for BASE are decimal 2, 8, 10, 16.  BASE must itself be
  1051.      specified either unambiguously or using the current default
  1052.      radix; for example, any of
  1053.  
  1054.           set radix 1010
  1055.           set radix 012
  1056.           set radix 10.
  1057.           set radix 0xa
  1058.  
  1059.      will set the base to decimal.  On the other hand, `set radix 10'
  1060.      will leave the radix unchanged no matter what it was.
  1061.  
  1062. `show radix'
  1063.      Display the current default base for numeric input and display.
  1064.  
  1065. 
  1066. File: gdb.info,  Node: Messages/Warnings,  Prev: Numbers,  Up: Controlling GDB
  1067.  
  1068. Optional Warnings and Messages
  1069. ==============================
  1070.  
  1071.    By default, GDB is silent about its inner workings.  If you are
  1072. running on a slow machine, you may want to use the `set verbose'
  1073. command.  It will make GDB tell you when it does a lengthy internal
  1074. operation, so you will not think it has crashed.
  1075.  
  1076.    Currently, the messages controlled by `set verbose' are those which
  1077. announce that the symbol table for a source file is being read (*note
  1078. Commands to Specify Files: Files., in the description of the command
  1079. `symbol-file').
  1080.  
  1081. `set verbose on'
  1082.      Enables GDB's output of certain informational messages.
  1083.  
  1084. `set verbose off'
  1085.      Disables GDB's output of certain informational messages.
  1086.  
  1087. `show verbose'
  1088.      Displays whether `set verbose' is on or off.
  1089.  
  1090.    By default, if GDB encounters bugs in the symbol table of an object
  1091. file, it is silent; but if you are debugging a compiler, you may find
  1092. this information useful (*note Errors Reading Symbol Files: Symbol
  1093. Errors.).
  1094.  
  1095. `set complaints LIMIT'
  1096.      Permits GDB to output LIMIT complaints about each type of unusual
  1097.      symbols before becoming silent about the problem.  Set LIMIT to
  1098.      zero to suppress all complaints; set it to a large number to
  1099.      prevent complaints from being suppressed.
  1100.  
  1101. `show complaints'
  1102.      Displays how many symbol complaints GDB is permitted to produce.
  1103.  
  1104.    By default, GDB is cautious, and asks what sometimes seem to be a
  1105. lot of stupid questions to confirm certain commands.  For example, if
  1106. you try to run a program which is already running:
  1107.  
  1108.      (gdb) run
  1109.      The program being debugged has been started already.
  1110.      Start it from the beginning? (y or n)
  1111.  
  1112.    If you are willing to unflinchingly face the consequences of your
  1113. own commands, you can disable this "feature":
  1114.  
  1115. `set confirm off'
  1116.      Disables confirmation requests.
  1117.  
  1118. `set confirm on'
  1119.      Enables confirmation requests (the default).
  1120.  
  1121. `show confirm'
  1122.      Displays state of confirmation requests.
  1123.  
  1124.    Some systems allow individual object files that make up your
  1125. program to be replaced without stopping and restarting your program. 
  1126. For example, in VxWorks you can simply recompile a defective object
  1127. file and keep on running.  If you are running on one of these systems,
  1128. you can allow GDB to reload the symbols for automatically relinked
  1129. modules:
  1130.  
  1131. `set symbol-reloading on'
  1132.      Replace symbol definitions for the corresponding source file when
  1133.      an object file with a particular name is seen again.
  1134.  
  1135. `set symbol-reloading off'
  1136.      Do not replace symbol definitions when re-encountering object
  1137.      files of the same name.  This is the default state; if you are
  1138.      not running on a system that permits automatically relinking
  1139.      modules, you should leave `symbol-reloading' off, since otherwise
  1140.      GDB may discard symbols when linking large programs, that may
  1141.      contain several modules (from different directories or libraries)
  1142.      with the same name.
  1143.  
  1144. `show symbol-reloading'
  1145.      Show the current `on' or `off' setting.
  1146.  
  1147. 
  1148. File: gdb.info,  Node: Sequences,  Next: Emacs,  Prev: Controlling GDB,  Up: Top
  1149.  
  1150. Canned Sequences of Commands
  1151. ****************************
  1152.  
  1153.    Aside from breakpoint commands (*note Breakpoint Command Lists:
  1154. Break Commands.), GDB provides two ways to store sequences of commands
  1155. for execution as a unit: user-defined commands and command files.
  1156.  
  1157. * Menu:
  1158.  
  1159. * Define::                      User-Defined Commands
  1160. * Command Files::               Command Files
  1161. * Output::                      Commands for Controlled Output
  1162.  
  1163. 
  1164. File: gdb.info,  Node: Define,  Next: Command Files,  Prev: Sequences,  Up: Sequences
  1165.  
  1166. User-Defined Commands
  1167. =====================
  1168.  
  1169.    A "user-defined command" is a sequence of GDB commands to which you
  1170. assign a new name as a command.  This is done with the `define'
  1171. command.
  1172.  
  1173. `define COMMANDNAME'
  1174.      Define a command named COMMANDNAME.  If there is already a command
  1175.      by that name, you are asked to confirm that you want to redefine
  1176.      it.
  1177.  
  1178.      The definition of the command is made up of other GDB command
  1179.      lines, which are given following the `define' command.  The end
  1180.      of these commands is marked by a line containing `end'.
  1181.  
  1182. `document COMMANDNAME'
  1183.      Give documentation to the user-defined command COMMANDNAME.  The
  1184.      command COMMANDNAME must already be defined.  This command reads
  1185.      lines of documentation just as `define' reads the lines of the
  1186.      command definition, ending with `end'.  After the `document'
  1187.      command is finished, `help' on command COMMANDNAME will print the
  1188.      documentation you have specified.
  1189.  
  1190.      You may use the `document' command again to change the
  1191.      documentation of a command.  Redefining the command with `define'
  1192.      does not change the documentation.
  1193.  
  1194. `help user-defined'
  1195.      List all user-defined commands, with the first line of the
  1196.      documentation (if any) for each.
  1197.  
  1198. `info user'
  1199. `info user COMMANDNAME'
  1200.      Display the GDB commands used to define COMMANDNAME (but not its
  1201.      documentation).  If no COMMANDNAME is given, display the
  1202.      definitions for all user-defined commands.
  1203.  
  1204.    User-defined commands do not take arguments.  When they are
  1205. executed, the commands of the definition are not printed.  An error in
  1206. any command stops execution of the user-defined command.
  1207.  
  1208.    Commands that would ask for confirmation if used interactively
  1209. proceed without asking when used inside a user-defined command.  Many
  1210. GDB commands that normally print messages to say what they are doing
  1211. omit the messages when used in a user-defined command.
  1212.  
  1213. 
  1214. File: gdb.info,  Node: Command Files,  Next: Output,  Prev: Define,  Up: Sequences
  1215.  
  1216. Command Files
  1217. =============
  1218.  
  1219.    A command file for GDB is a file of lines that are GDB commands. 
  1220. Comments (lines starting with `#') may also be included.  An empty
  1221. line in a command file does nothing; it does not mean to repeat the
  1222. last command, as it would from the terminal.
  1223.  
  1224.    When you start GDB, it automatically executes commands from its
  1225. "init files".  These are files named `.gdbinit'.  GDB reads the init
  1226. file (if any) in your home directory and then the init file (if any)
  1227. in the current working directory.  (The init files are not executed if
  1228. you use the `-nx' option; *note Choosing Modes: Mode Options..)  You
  1229. can also request the execution of a command file with the `source'
  1230. command:
  1231.  
  1232. `source FILENAME'
  1233.      Execute the command file FILENAME.
  1234.  
  1235.    The lines in a command file are executed sequentially.  They are not
  1236. printed as they are executed.  An error in any command terminates
  1237. execution of the command file.
  1238.  
  1239.    Commands that would ask for confirmation if used interactively
  1240. proceed without asking when used in a command file.  Many GDB commands
  1241. that normally print messages to say what they are doing omit the
  1242. messages when called from command files.
  1243.  
  1244.